import { request } from "@umijs/max";;
import { UMS_REQUEST_PREFIX } from "@/utils/config";

/**
 * 登录
 * @returns 
 */
export async function login(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/sso/auth/accessToken`, {
    method: 'POST',
    isJson: true,
    data: {
      ...params,
      "clientId": "erp",
      "grantType": "password",
    }
  });
}
/**
 * 修改密码
 * @returns 
 */
export async function modifyPassword(params: any) {
  return request(`${UMS_REQUEST_PREFIX}/sso/auth/modifyPassword`, {
    method: 'POST',
    data: params
  });
}
/**
 * 获取用户信息
 * @returns 
 */
export async function fetchInnerUserInfo() {
  return request(`${UMS_REQUEST_PREFIX}/sso/innerUser/userInfo`, {
    method: 'POST'
  });
}